﻿using System;
using Beaker.Injection;
using Beaker.Specs;
using Moq;

namespace OpenCube.Nbt.Specs.Builders
{
	/// <summary>
	/// Special stub that uses the Activator to create instances of physical class queried through the container
	/// </summary>
	internal sealed class QueryContainerStubUsingActivatorBuilder
		: MockBuilder<IQueryContainer>
	{
		protected override void BuildMock(Mock<IQueryContainer> mock)
		{
			// stub by trying to use activator to create instance of actual types
			mock
				.Setup(qc => qc.GetInstance(It.IsAny<Type>()))
				.Returns<Type>(Activator.CreateInstance);
		}
	}
}